package cn.wonderland.base.enm;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum LogStateEnum {
    AUDIT(0,"待审核"),
    AUDIT_PASS(1,"审核通过"),
    AUDIT_REJECT(2,"审核驳回"),
    ACTIVITY(3,"已激活");

    public static String getNameByCode(Integer code) {
        Optional<LogStateEnum> first = Arrays.stream(LogStateEnum.values()).filter(state ->
                state.getCode() == code).findFirst();
        return first.isPresent() ? first.get().getName() : "";
    }


    private int code;
    private String name;
}
